package com.evola.conditionalformatting
{
	import mx.formatters.DateFormatter;

	internal class Utils
	{



		public static function stringToDate(dateString:String):Date
		{

			var inputFormat:String=ConditionalFormattingSettings.DATE_FORMAT;

			var modifiedValue:String="MM/DD/YYYY";

			//izdvajamo mesec
			var tmpInt:int=inputFormat.indexOf("MM");
			var tmpVal:String=dateString.substr(tmpInt, 2);
			modifiedValue=modifiedValue.replace("MM", tmpVal);
			//izdvajamo dane
			tmpInt=inputFormat.indexOf("DD");
			tmpVal=dateString.substr(tmpInt, 2)
			modifiedValue=modifiedValue.replace("DD", tmpVal);
			//izdvajao godinu...
			tmpInt=inputFormat.indexOf("YYYY");
			tmpVal=dateString.substr(tmpInt, 4)
			modifiedValue=modifiedValue.replace("YYYY", tmpVal);

			var date : Date = DateFormatter.parseDateString(dateString);
			
			return date;
		}

	}
}
